package com.example.g5project.chat.model.result;

import com.example.g5project.chat.constant.ImBaseConstant;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import lombok.Data;

@Data
public class MessageReceiveResult {

    @JsonProperty("ActionStatus")
    private String actionStatus;

    @JsonProperty("ErrorInfo")
    private String errorInfo;

    @JsonProperty("ErrorCode")
    private Integer errorCode;

    @JsonProperty("Complete")
    private Integer complete;

    @JsonProperty("MsgCnt")
    private Integer msgCnt;

    @JsonProperty("LastMsgTime")
    private Integer lastMsgTime;

    @JsonProperty("LastMsgKey")
    private String lastMsgKey;

    @JsonProperty("MsgList")
    private List<Message> msgList;

    @Data
    public static class Message {

        @JsonProperty("From_Account")
        private String fromAccount;

        @JsonProperty("To_Account")
        private String toAccount;

        @JsonProperty("MsgSeq")
        private Integer msgSeq;

        @JsonProperty("MsgRandom")
        private Integer msgRandom;

        @JsonProperty("MsgTimeStamp")
        private Integer msgTimeStamp;

        @JsonProperty("MsgClientTime")
        private Integer msgClientTime;

        @JsonProperty("MsgFlagBits")
        private Integer msgFlagBits;

        @JsonProperty("MsgKey")
        private String msgKey;

        @JsonProperty("MsgBody")
        private List<MessageBody> msgBody;
    }

    @Data
    public static class MessageBody {

        @JsonProperty("MsgType")
        private String msgType;

        @JsonProperty("MsgContent")
        private Object msgContent;
    }



    public Boolean isRight() {
        return ImBaseConstant.ACTION_STATUS_OK.equals(this.actionStatus);
    }

}
